Conventionally, in an operation device such as a central processing unit (referred to as CPU below), a cache is used in order to access data necessary for an operation and processing in a short period of time.
The cache temporarily holds data on a main memory. Thus, when each operation device uses the cache, it is necessary to maintain coherence of the temporarily-held data among the caches. Since the plurality of operation devices are normally connected via an interconnect such as a bus, a cache coherent protocol is used in which cache coherence is maintained via the interconnect.
For example, an MESI protocol in which each data on a cache is managed in four types of states: Modified, Exclusive, Shared, and Invalid is employed as the cache coherent protocol. In the MESI protocol, Modified indicates that data is updated, Exclusive indicates that another cache does not hold the data, Shared indicates that the other cache holds the data, and Invalid indicates that the cache does not hold the data.
For example, a snoop request response method is employed as a method of appropriately managing a data state among the caches in the cache coherent protocol.
A snoop request is a request transmitted from a cache of an operation device that performs data access to another cache. A snoop response is a response transmitted from the cache receiving the request to the cache transmitting the request.
The snoop request includes a Read Request for requesting transmission of data when an operation device reads out data, and an Invalidate Request for requesting invalidation of data when an operation device writes data.
The snoop response includes a Read Unique Response, a Read Shared Response, and an Invalidated Response. The Read Unique Response indicates that the data is not held on another cache as a response to the Read Request. The Read Shared Response indicates that the data is held on the other cache. The Invalidated Response indicates that the data invalidation is completed as a response to the Invalidate Request.
When an operation device reads out data, the operation device uses data in a case in which the data is held in a cache of the operation device. The cache of the operation device transmits the Read Request together with an address of the data to the interconnect in a case in which the data is not held.
In a case in which another cache receiving the Read Request holds the data, the cache transmits the Read Shared Response together with the data to the interconnect. At this time, the data is held in both of the caches, so that a state of the data in both of the caches is Shared.
In a case in which all the caches receiving the Read Request do not hold the data, for example, the main memory transmits the Read Unique Response together with the data. At this time, only the cache transmitting the Read Request holds the data, so that the state of the data in the cache is Exclusive.
When the operation device writes data, the following operation is performed according to a state of the data. In a case in which the state is Modified or Exclusive, the cache updates the data. In a case in which the state is Shared or Invalid, the cache transmits the Invalidate Request together with an address of the data, and is on standby until receiving the Invalidated Response.
In a case in which another cache receiving the Invalidate Request holds the data, the following operation is performed according to the state of the data. In a case in which the state is Modified, the other cache transmits the Invalidated Response after writing the data into the main memory. In a case in which the state is Exclusive or Shared, the other cache transmits the Invalidated Response after invalidating the data. In a case in which the state is Invalid, the other cache transmits the Invalidated Response. At this time, the data state of the cache is Invalid. The cache receiving the Invalidated Response transmits the Read Request, and acquires and updates the data when the data state is Invalid. The data state of the cache updating the data is Modified.
As described above, coherence of data among the caches is maintained by the cache coherent protocol.
By the way, when the plurality of operation devices perform processing in association, it is necessary to synchronize the processing. For example, an acquire release method of performing synchronization based on the cache coherent protocol is employed as a method of synchronization among the plurality of operation devices including the caches.
In the acquire release method, before updating a synchronization variable in data, an operation device requests Acquire of the synchronization variable at the time of reading out the synchronization variable. A cache of the operation device holds the data in which the synchronization variable is included, records that Acquire is requested, and, for example, changes an Acquire flag of a line including the data to “1”. After that, when a state of the data is changed to Invalid by another operation device rewriting the data, the record that Acquire is requested is deleted. For example, the Acquire flag is changed to “0” from “1”.
When updating the synchronization variable, the operation device requests Release for the cache as well as transmitting the updated data. When the Acquire request is recorded (for example, when the Acquire flag is “1”), the cache changes the synchronization variable by the updated data, and notifies the operation device that the Release request succeeds. However, when the Acquire request is not recorded (for example, when the Acquire flag is “0”), the cache discards the updated data, and notifies the operation device that the Release request fails. When the Release request fails, the operation device retries to update the synchronization variable.
When processing using the synchronization variable is performed, the processing is put on standby until the synchronization variable satisfies specific conditions. Examples of the conditions include that the synchronization variable has a specific value, a specific bit of the synchronization variable is 1, and all bits of the synchronization variable are 1.
Normally, when the operation device is on standby for synchronization without performing processing, the operation device is caused to transition to a power saving mode from a normal mode until a value of the synchronization variable is changed in order to reduce power consumption. The normal mode is a mode in which operation processing can be executed. The power saving mode is a mode in which the operation processing is suspended. By stopping the clock or cutting off the power supply to the operation device, power consumption of the operation device can be reduced.
Particularly, when processing is synchronized based on the cache coherent protocol, the cache is required in the operation device that performs processing synchronization. A circuit scale and power consumption of a semiconductor apparatus on which the operation device is mounted are disadvantageously increased.
Moreover, when processing is put on standby by using the synchronization variable, the synchronization conditions may not be satisfied even when the synchronization variable is changed. Even in such a case, the operation device is restored to the normal mode from the power saving mode, so that power consumption regarding mode transition is disadvantageously increased. For example, when the operation device confirms transmission and reception of the Invalidate Request between the caches, the operation device is restored to the normal mode from the power saving mode even when the value of the synchronization variable does not satisfy the conditions of the synchronization, in other words, even before the conditions of the synchronization are satisfied. Thus, power consumption is increased.